package com.sunshine.student_register.ui.activity.main;

import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;

import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;

import com.sunshine.student_register.database.StudentRegisterRepository;

/**
 * @author sunshine
 * @date 2020/5/30
 * 主活动的viewModel类，用于调控非界面的数据处理
 */
public class MainViewModel extends AndroidViewModel {

    private SharedPreferences sp;

    public MainViewModel(@NonNull Application application) {
        super(application);

        sp = getApplication().getSharedPreferences("app_setting", Context.MODE_PRIVATE);
    }

    void unLogin(){
        sp.edit().putInt("user_id", -1).apply();
    }
}
